/* ============================================
   PLANIX CRM - ADAPTIVE DESIGN STYLES (СИРЕНЕВЫЙ)
   ============================================ */

:root {
    --primary: #b8a0c8;
    --primary-dark: #9b84ab;
    --primary-light: #ede5f5;
    --primary-bg: #f7f2fa;
    --secondary: #e8ddf0;
    --card-bg: #ffffff;
    --text: #3d3a4a;
    --text-light: #8a7a9a;
    --border: #ede8f0;
    --shadow: rgba(150, 130, 170, 0.12);
    --success: #a8c4a0;
    --success-bg: #eaf5e8;
    --danger: #e8a0a0;
    --danger-bg: #f5e8e8;
    --radius: 16px;
    --radius-lg: 24px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--primary-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ============================================
   LOGIN
   ============================================ */
.login-body {
    background: linear-gradient(135deg, #b8a0c8 0%, #9b84ab 50%, #7a6a8a 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 0 12px;
}

.login-card {
    background: white;
    border-radius: 32px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(150, 130, 170, 0.25);
    text-align: center;
    transition: all 0.3s;
}

.logo-large {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #b8a0c8, #9b84ab);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}

.login-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 700;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 15px;
}

.error {
    background: var(--danger-bg);
    color: #8a5a5a;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #f0d0d0;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 16px;
    pointer-events: none;
    transition: color 0.3s;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border);
    border-radius: 16px;
    font-size: 16px;
    background: var(--primary-bg);
    color: var(--text);
    transition: all 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(184, 160, 200, 0.15);
    background: white;
}

.input-group input:focus + i,
.input-group input:focus ~ i {
    color: var(--primary-dark);
}

.input-group input::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--primary-bg);
    min-height: 100vh;
    min-height: 100dvh;
    box-shadow: 0 0 40px var(--shadow);
    position: relative;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: white;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #b8a0c8, #9b84ab);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    background: #4a3a4a;
    -webkit-text-fill-color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    margin-left: 8px;
}

/* ============================================
   CONTENT
   ============================================ */
.content {
    padding: 16px 16px 90px;
}

/* ============================================
   BOTTOM NAV
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 10px 12px calc(18px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    z-index: 20;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    text-decoration: none !important;
    padding: 6px 12px;
    border-radius: 14px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-width: 56px;
}

.nav-item i {
    font-size: 24px;
    transition: all 0.2s;
}

.nav-item span {
    font-size: 10px;
    letter-spacing: 0.3px;
}

.nav-item.active {
    color: var(--primary-dark);
    background: var(--primary-light);
}

.nav-item.active i {
    transform: scale(1.08);
}

.nav-item:active {
    transform: scale(0.92);
}

.nav-item .fa-plus-circle {
    font-size: 32px;
    color: var(--primary-dark);
    background: white;
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-top: -8px;
}

.nav-item.active .fa-plus-circle {
    color: var(--primary);
    transform: scale(1.1);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, #b8a0c8, #9b84ab);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    display: inline-block;
    transition: all 0.2s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #98b890;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #c89090;
}

.btn-secondary {
    background: #e0d4e0;
    color: var(--text);
}

.btn-secondary:hover {
    background: #d4c8d4;
}

.login-card .btn-primary {
    background: linear-gradient(135deg, #b8a0c8, #9b84ab);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    display: inline-block;
    transition: all 0.3s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.5px;
}

.login-card .btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(150, 130, 170, 0.3);
}

.login-card .btn-primary:active {
    transform: scale(0.97);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px var(--shadow);
    transition: all 0.2s;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
}

.section-title i {
    color: var(--primary-dark);
    margin-right: 8px;
}

.welcome-text {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.welcome-sub {
    color: var(--text-light);
    font-size: 14px;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions {
    display: flex;
    gap: 10px;
}

.action-card {
    flex: 1;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    display: block;
    -webkit-tap-highlight-color: transparent;
}

.action-card:active {
    transform: scale(0.95);
}

.action-card i {
    font-size: 26px;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.action-card span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

/* ============================================
   MENU GRID
   ============================================ */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.menu-item {
    background: var(--primary-bg);
    padding: 14px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border);
    text-decoration: none !important;
    display: block;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.menu-item:active {
    transform: scale(0.95);
}

.menu-item i {
    font-size: 22px;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.menu-item span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
}

/* ============================================
   LINK ROW
   ============================================ */
.link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--primary-bg);
    border-radius: 14px;
    margin-bottom: 8px;
    transition: all 0.2s;
    text-decoration: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.link-row:active {
    transform: scale(0.97);
}

.link-row span {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.link-row span i {
    margin-right: 8px;
    color: var(--primary-dark);
}

.copy-btn {
    background: none;
    border: none;
    font-size: 17px;
    cursor: pointer;
    color: var(--primary-dark);
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.copy-btn:active {
    transform: scale(0.85);
}

/* ============================================
   JOURNAL
   ============================================ */
.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 10px 16px;
    border-radius: 40px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.date-nav a {
    color: var(--primary-dark);
    text-decoration: none !important;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}

.date-nav a:active {
    transform: scale(0.9);
}

.date-nav i {
    font-size: 16px;
}

.current-date {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.journal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.journal-item {
    background: white;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    gap: 12px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.journal-item:active {
    transform: scale(0.98);
}

.journal-item-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    flex-shrink: 0;
    padding-right: 12px;
    border-right: 2px solid var(--border);
}

.journal-item-time .time-start {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.journal-item-time .time-separator {
    font-size: 10px;
    color: var(--text-light);
    margin: 1px 0;
}

.journal-item-time .time-end {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-dark);
}

.journal-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.journal-item-client {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.journal-item-client .client-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.journal-item-client .client-phone {
    font-size: 12px;
    color: var(--text-light);
}

.journal-item-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.journal-item-details .detail-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
}

.journal-item-details .detail-duration {
    font-size: 12px;
    color: var(--text-light);
}

.journal-item-details .detail-services {
    font-size: 12px;
    color: var(--text-light);
}

.journal-item-actions {
    display: flex;
    align-items: center;
    padding-left: 10px;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}

.journal-item-actions .action-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.journal-item-actions .action-btn:active {
    transform: scale(0.85);
}

/* ============================================
   BOOKING
   ============================================ */
.booking-success {
    text-align: center;
    padding: 10px 0;
}

.booking-success .success-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.booking-success h3 {
    font-size: 22px;
    color: #5a7a52;
    margin-bottom: 14px;
}

.booking-success .success-details {
    background: var(--primary-bg);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    text-align: left;
}

.booking-success .success-details p {
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    margin: 0;
}

.booking-success .success-details p:last-child {
    border-bottom: none;
}

.booking-success .success-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.booking-search {
    position: relative;
    margin-bottom: 12px;
}

.booking-search input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: var(--primary-bg);
    color: var(--text);
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.booking-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(184, 160, 200, 0.15);
}

.booking-search input::placeholder {
    color: var(--text-light);
}

.booking-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 16px var(--shadow);
}

.search-results .result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.search-results .result-item:active {
    background: var(--primary-light);
}

.search-results .result-item:last-child {
    border-bottom: none;
}

.search-results .result-item .item-name {
    font-weight: 500;
    color: var(--text);
}

.search-results .result-item .item-desc {
    font-size: 12px;
    color: var(--text-light);
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.time-slot {
    padding: 8px 4px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    transition: all 0.2s;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
}

.time-slot.available {
    background: #ede5f5;
    color: var(--text);
    cursor: pointer;
}

.time-slot.available:active {
    transform: scale(0.92);
}

.time-slot.busy {
    background: var(--danger-bg);
    color: #b08080;
    border-color: #f0d0d0;
    cursor: not-allowed;
    opacity: 0.7;
}

.time-slot.busy .busy-label {
    font-size: 7px;
    opacity: 0.7;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.time-slot.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
}

.client-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.client-row .search-wrap {
    flex: 1;
    min-width: 150px;
    position: relative;
}

.client-row .btn-add-client {
    background: linear-gradient(135deg, #b8a0c8, #9b84ab);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.client-row .btn-add-client:active {
    transform: scale(0.95);
}

.selected-display {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-dark);
}

.legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    flex-wrap: wrap;
}

.legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend .dot.free {
    background: #d4c8d4;
}

.legend .dot.busy {
    background: #f0d0d0;
}

/* ============================================
   CLIENTS
   ============================================ */
.clients-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.clients-header .search-box {
    flex: 1;
    position: relative;
}

.clients-header .search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.clients-header .search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: var(--primary-bg);
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.3s;
}

.clients-header .search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(184, 160, 200, 0.15);
}

.client-card {
    background: white;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.client-card:active {
    transform: scale(0.98);
}

.client-info {
    flex: 1;
    min-width: 0;
}

.client-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text);
    word-break: break-word;
}

.client-info p {
    font-size: 12px;
    color: var(--text-light);
}

.client-info p i {
    margin-right: 4px;
    font-size: 11px;
    color: var(--primary-dark);
}

.client-badge {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.client-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.delete-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--danger);
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.delete-btn:active {
    transform: scale(0.85);
}

/* ============================================
   SERVICES
   ============================================ */
.service-item-with-photo {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--primary-bg);
    border-radius: 14px;
    margin-bottom: 8px;
    gap: 10px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.service-item-with-photo:active {
    transform: scale(0.98);
}

.service-photo {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}

.service-photo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-light);
    flex-shrink: 0;
}

.service-info {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.service-info .service-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    color: var(--text);
    word-break: break-word;
}

.service-info .service-meta {
    font-size: 11px;
    color: var(--text-light);
}

.service-price {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 14px;
    margin-right: 8px;
    white-space: nowrap;
}

.service-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(74, 58, 74, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-panel {
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text);
    margin: 0;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 4px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.back-btn:active {
    transform: scale(0.85);
}

.modal-panel input,
.modal-panel textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 10px;
    background: var(--primary-bg);
    color: var(--text);
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.modal-panel input:focus,
.modal-panel textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(184, 160, 200, 0.15);
}

.modal-panel textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.booking-detail-modal .detail-row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.booking-detail-modal .detail-row:last-child {
    border-bottom: none;
}

.booking-detail-modal .detail-label {
    font-weight: 600;
    width: 90px;
    color: var(--text-light);
    font-size: 13px;
    flex-shrink: 0;
}

.booking-detail-modal .detail-value {
    flex: 1;
    color: var(--text);
    font-size: 13px;
    word-break: break-word;
}

/* ============================================
   TELEGRAM
   ============================================ */
.telegram-connect {
    background: #27ae60;
    color: white;
    padding: 12px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.telegram-connect:active {
    transform: scale(0.97);
}

/* ============================================
   STATS
   ============================================ */
.income-stats {
    display: flex;
    gap: 10px;
}

.stat-card {
    flex: 1;
    background: var(--primary-bg);
    padding: 14px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-card.active {
    background: linear-gradient(135deg, #b8a0c8, #9b84ab);
    color: white;
}

.stat-card .amount {
    font-size: 22px;
    font-weight: 700;
}

.stat-card .label {
    font-size: 11px;
    margin-top: 4px;
}

/* ============================================
   CALENDAR
   ============================================ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 10px;
}

.calendar-weekday {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    padding: 6px 0;
    font-weight: 500;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    background: var(--primary-bg);
    transition: all 0.2s;
    position: relative;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

.calendar-day:active {
    transform: scale(0.85);
}

.calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar-day.selected {
    background: var(--primary);
    color: white;
}

.calendar-day.has-booking::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-dark);
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: #4a3a4a;
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 13px;
    z-index: 10000;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow);
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   LABELS   ============================================ */
label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}

/* ============================================
   SERVICE FORM
   ============================================ */
.service-form-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 12px;
}

.service-form-page .photo-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    background: var(--primary-bg);
}

.service-form-page .photo-upload-area:active {
    transform: scale(0.98);
}

.service-form-page .service-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 10px;
}

.service-form-page .photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
}

.service-form-page input[type="text"],
.service-form-page input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: var(--primary-bg);
    color: var(--text);
    transition: all 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.service-form-page input[type="text"]:focus,
.service-form-page input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(184, 160, 200, 0.15);
}

/* ============================================
   ANALYTICS
   ============================================ */
.analytics-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.analytics-page .stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.analytics-page .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.analytics-page .stat-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    border-radius: 12px;
}

.analytics-page .stat-info {
    flex: 1;
}

.analytics-page .stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.analytics-page .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.analytics-page .period-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.analytics-page .period-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: white;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.analytics-page .period-btn:active {
    transform: scale(0.95);
}

.analytics-page .period-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.analytics-page .chart-container {
    position: relative;
    height: 250px;
    margin-top: 10px;
}

/* ============================================
   ADAPTIVE - МОБИЛЬНЫЕ УЛУЧШЕНИЯ
   ============================================ */

/* LOGIN - АДАПТИВ */
@media (max-width: 768px) {
    .login-container {
        max-width: 380px;
        padding: 0 8px;
    }
    
    .login-card {
        padding: 32px 24px;
        border-radius: 28px;
    }
    
    .logo-large {
        font-size: 40px;
        margin-bottom: 20px;
    }
    
    .login-card h2 {
        font-size: 22px;
    }
    
    .login-card p {
        font-size: 14px;
        margin-bottom: 28px;
    }
    
    .input-group input {
        padding: 13px 14px 13px 44px;
        font-size: 15px;
    }
    
    .login-card .btn-primary {
        padding: 13px 18px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .login-body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .login-container {
        max-width: 100%;
        padding: 0 4px;
    }
    
    .login-card {
        padding: 28px 20px;
        border-radius: 24px;
        box-shadow: 0 10px 40px rgba(150, 130, 170, 0.2);
    }
    
    .logo-large {
        font-size: 36px;
        margin-bottom: 16px;
    }
    
    .login-card h2 {
        font-size: 20px;
    }
    
    .login-card p {
        font-size: 13px;
        margin-bottom: 24px;
    }
    
    .error {
        padding: 10px;
        font-size: 13px;
        border-radius: 10px;
    }
    
    .input-group {
        margin-bottom: 16px;
    }
    
    .input-group i {
        left: 14px;
        font-size: 15px;
    }
    
    .input-group input {
        padding: 12px 12px 12px 42px;
        font-size: 15px;
        border-radius: 14px;
        border-width: 2px;
    }
    
    .login-card .btn-primary {
        padding: 12px 16px;
        font-size: 15px;
        border-radius: 28px;
    }
}

@media (max-width: 360px) {
    .login-body {
        padding: 8px;
        padding-top: 30px;
    }
    
    .login-card {
        padding: 20px 16px;
        border-radius: 20px;
    }
    
    .logo-large {
        font-size: 30px;
        margin-bottom: 12px;
    }
    
    .login-card h2 {
        font-size: 18px;
    }
    
    .login-card p {
        font-size: 12px;
        margin-bottom: 20px;
    }
    
    .error {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .input-group i {
        left: 12px;
        font-size: 14px;
    }
    
    .input-group input {
        padding: 10px 10px 10px 38px;
        font-size: 14px;
        border-radius: 12px;
    }
    
    .login-card .btn-primary {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 24px;
    }
}

@media (min-width: 769px) {
    .login-container {
        max-width: 420px;
    }
    
    .login-card {
        padding: 48px 40px;
        border-radius: 36px;
    }
    
    .logo-large {
        font-size: 52px;
        margin-bottom: 28px;
    }
    
    .login-card h2 {
        font-size: 26px;
    }
    
    .login-card p {
        font-size: 16px;
        margin-bottom: 36px;
    }
    
    .input-group input {
        padding: 16px 18px 16px 52px;
        font-size: 17px;
    }
    
    .login-card .btn-primary {
        padding: 16px 24px;
        font-size: 17px;
    }
}

/* BOTTOM NAV - АДАПТИВ */
@media (max-width: 768px) {
    .bottom-nav {
        padding: 8px 12px calc(16px + var(--safe-bottom));
    }
    
    .nav-item {
        padding: 6px 10px;
        min-width: 50px;
    }
    
    .nav-item i {
        font-size: 22px;
    }
    
    .nav-item .fa-plus-circle {
        font-size: 30px;
        margin-top: -6px;
    }
}

@media (max-width: 480px) {
    .bottom-nav {
        padding: 8px 8px calc(14px + var(--safe-bottom));
        gap: 2px;
    }
    
    .nav-item {
        padding: 4px 8px;
        min-width: 44px;
        gap: 2px;
    }
    
    .nav-item i {
        font-size: 20px;
    }
    
    .nav-item span {
        font-size: 9px;
    }
    
    .nav-item .fa-plus-circle {
        font-size: 28px;
        margin-top: -6px;
    }
}

@media (max-width: 360px) {
    .bottom-nav {
        padding: 6px 4px calc(12px + var(--safe-bottom));
        gap: 0;
    }
    
    .nav-item {
        padding: 4px 4px;
        min-width: 36px;
        border-radius: 10px;
    }
    
    .nav-item i {
        font-size: 18px;
    }
    
    .nav-item span {
        font-size: 8px;
    }
    
    .nav-item .fa-plus-circle {
        font-size: 24px;
        margin-top: -4px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .bottom-nav {
        padding: 10px 16px calc(16px + var(--safe-bottom));
    }
    
    .nav-item {
        padding: 6px 14px;
    }
    
    .nav-item i {
        font-size: 22px;
    }
    
    .nav-item span {
        font-size: 10px;
    }
    
    .nav-item .fa-plus-circle {
        font-size: 30px;
        margin-top: -6px;
    }
}

/* ОБЩИЙ АДАПТИВ ДЛЯ ВСЕХ СТРАНИЦ */
@media (max-width: 768px) {
    .app-container {
        max-width: 100%;
    }
    
    .header {
        padding: 12px 16px 10px;
    }
    
    .content {
        padding: 12px 12px 80px;
    }
    
    .card {
        padding: 14px;
        border-radius: 14px;
        margin-bottom: 12px;
    }
    
    .section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .logo span {
        font-size: 10px;
    }
    
    .welcome-text {
        font-size: 20px;
    }
    
    .quick-actions {
        gap: 8px;
    }
    
    .action-card {
        padding: 12px;
        border-radius: 12px;
    }
    
    .action-card i {
        font-size: 22px;
    }
    
    .action-card span {
        font-size: 12px;
    }
    
    .menu-grid {
        gap: 8px;
    }
    
    .menu-item {
        padding: 12px;
        border-radius: 12px;
    }
    
    .menu-item i {
        font-size: 20px;
    }
    
    .menu-item span {
        font-size: 11px;
    }
    
    /* Журнал */
    .journal-item {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 8px;
    }
    
    .journal-item-time {
        flex-direction: row;
        min-width: auto;
        padding-right: 0;
        padding-bottom: 6px;
        border-right: none;
        border-bottom: 2px solid var(--border);
        justify-content: flex-start;
        gap: 4px;
    }
    
    .journal-item-time .time-start {
        font-size: 17px;
    }
    
    .journal-item-time .time-end {
        font-size: 14px;
    }
    
    .journal-item-actions {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 8px;
        justify-content: flex-end;
    }
    
    /* Клиенты */
    .clients-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .clients-header .btn-primary {
        width: 100%;
        text-align: center;
    }
    
    .client-card {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 14px;
    }
    
    .client-badge {
        align-self: flex-start;
    }
    
    .client-actions {
        border-top: 1px solid var(--border);
        padding-top: 8px;
        justify-content: flex-end;
    }
    
    /* Услуги */
    .service-item-with-photo {
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .service-price {
        margin-left: auto;
    }
    
    .service-actions {
        margin-left: auto;
    }
    
    /* Время (booking) */
    .time-slots-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    
    .time-slot {
        font-size: 11px;
        padding: 6px 2px;
        min-height: 38px;
    }
    
    .client-row {
        flex-direction: column;
    }
    
    .client-row .search-wrap {
        width: 100%;
        min-width: auto;
    }
    
    .client-row .btn-add-client {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
    
    .booking-success .success-actions {
        flex-direction: column;
    }
    
    .booking-success .success-actions .btn-primary {
        width: 100%;
    }
    
    /* Модалка */
    .modal-panel {
        padding: 16px;
        border-radius: 20px 20px 0 0;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-panel input,
    .modal-panel textarea {
        font-size: 13px;
        padding: 8px 10px;
    }
    
    /* Статистика */
    .income-stats {
        flex-direction: column;
    }
    
    /* Аналитика */
    .analytics-page .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-page .chart-container {
        height: 200px;
    }
    
    .analytics-page .period-selector {
        gap: 6px;
    }
    
    .analytics-page .period-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Календарь */
    .calendar-day {
        font-size: 12px;
    }
    
    .calendar-day.has-booking::after {
        width: 4px;
        height: 4px;
        bottom: 3px;
    }
    
    .legend {
        font-size: 11px;
        gap: 10px;
    }
    
    /* Service Form */
    .service-form-page {
        padding: 8px;
    }
    
    .service-form-page .photo-upload-area {
        padding: 16px;
    }
    
    .service-form-page .service-preview {
        max-width: 150px;
        max-height: 150px;
    }
    
    .service-form-page .photo-placeholder {
        padding: 20px;
    }
    
    .service-form-page input[type="text"],
    .service-form-page input[type="number"] {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .time-slots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .journal-item-time .time-start {
        font-size: 15px;
    }
    
    .journal-item-time .time-end {
        font-size: 13px;
    }
    
    .journal-item-client .client-name {
        font-size: 13px;
    }
    
    .service-form-page .photo-upload-area {
        padding: 12px;
    }
    
    .service-form-page .service-preview {
        max-width: 120px;
        max-height: 120px;
    }
    
    .service-form-page input[type="text"],
    .service-form-page input[type="number"] {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .analytics-page .chart-container {
        height: 160px;
    }
}

@media (min-width: 769px) {
    .app-container {
        border-radius: 0;
        box-shadow: 0 0 60px var(--shadow);
        max-width: 500px;
    }
    
    .content {
        padding: 20px 20px 90px;
    }
    
    .card {
        padding: 20px;
        border-radius: 18px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .analytics-page .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Для устройств с поддержкой hover */
@media (hover: hover) {
    .login-card .btn-primary:hover {
        opacity: 0.9;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(150, 130, 170, 0.35);
    }
    
    .nav-item:hover {
        color: var(--primary-dark);
    }
    
    .nav-item:not(.active):hover {
        background: var(--primary-bg);
    }
    
    .action-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px var(--shadow);
    }
    
    .menu-item:hover {
        background: var(--primary-light);
        transform: translateY(-2px);
    }
    
    .link-row:hover {
        background: var(--primary-light);
    }
    
    .time-slot.available:hover {
        background: var(--primary);
        color: white;
        transform: scale(1.02);
    }
    
    .client-card:hover {
        border-color: var(--primary);
        box-shadow: 0 2px 8px var(--shadow);
    }
    
    .journal-item:hover {
        border-color: var(--primary);
        box-shadow: 0 2px 8px var(--shadow);
    }
    
    .service-item-with-photo:hover {
        border-color: var(--primary);
    }
    
    .delete-btn:hover {
        background: var(--danger-bg);
    }
    
    .back-btn:hover {
        color: var(--text);
    }
    
    .btn-primary:hover {
        opacity: 0.9;
        transform: translateY(-1px);
    }
    
    .analytics-page .period-btn:hover {
        background: var(--primary-light);
    }
}

/* Для устройств с touch */
@media (hover: none) {
    .login-card .btn-primary:active {
        transform: scale(0.95);
    }
    
    .nav-item:active {
        transform: scale(0.92);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   UTILITY
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }