/**
 * Public Styles for ESP Payment System
 *
 * @package ESP
 * @version 1.0.0
 */

/* ============================================
   ОБЩИЕ СТИЛИ
   ============================================ */

.esp-dashboard-container,
.esp-payment-form-container,
.esp-invoice-history,
.esp-lesson-schedule,
.esp-profile-editor {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.esp-button {
    display: inline-block;
    padding: 10px 20px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.esp-button:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.esp-button-small {
    padding: 6px 12px;
    font-size: 13px;
}

.esp-button-large {
    padding: 14px 28px;
    font-size: 16px;
}

.esp-button-secondary {
    background: #f0f0f1;
    color: #333;
}

.esp-button-secondary:hover {
    background: #ddd;
    color: #333;
}

.esp-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   ДАШБОРД
   ============================================ */

.esp-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 30px;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .esp-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.esp-welcome-section {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: #fff;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.esp-welcome-section h2 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 24px;
}

.esp-welcome-date {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

.esp-widget {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.esp-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f1;
}

.esp-widget-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.esp-view-all {
    color: #007cba;
    text-decoration: none;
    font-size: 13px;
}

/* ============================================
   СЧЕТА
   ============================================ */

.esp-invoices-table-responsive {
    overflow-x: auto;
}

.esp-invoices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.esp-invoices-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.esp-invoices-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.esp-invoice-row:hover {
    background: #f8f9fa;
}

.esp-amount {
    font-weight: 600;
    color: #28a745;
}

.esp-overdue {
    color: #dc3545;
    font-weight: 500;
}

.esp-overdue-badge {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 6px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    border-radius: 3px;
    text-transform: uppercase;
}

.esp-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.esp-status-paid {
    background: #d4edda;
    color: #155724;
}

.esp-status-sent,
.esp-status-pending {
    background: #fff3cd;
    color: #856404;
}

.esp-status-draft {
    background: #e2e3e5;
    color: #383d41;
}

.esp-status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   РАСПИСАНИЕ
   ============================================ */

.esp-schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.esp-schedule-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.esp-nav-button {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
}

.esp-nav-button:hover {
    background: #e9ecef;
}

.esp-week-schedule {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.esp-schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-right: 1px solid #dee2e6;
}

.esp-schedule-day {
    border-left: 1px solid #dee2e6;
}

.esp-day-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.esp-day-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.esp-day-date {
    font-size: 12px;
    color: #6c757d;
}

.esp-day-lessons {
    min-height: 200px;
    padding: 10px;
}

.esp-lesson-card {
    padding: 10px;
    margin-bottom: 10px;
    background: #e3f2fd;
    border-left: 3px solid #007cba;
    border-radius: 4px;
    font-size: 13px;
}

.esp-lesson-status-cancelled {
    background: #f8d7da;
    border-left-color: #dc3545;
    opacity: 0.7;
}

.esp-lesson-status-completed {
    background: #d4edda;
    border-left-color: #28a745;
}

.esp-lesson-time {
    font-weight: 600;
    margin-bottom: 5px;
}

.esp-month-schedule {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.esp-month-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.esp-month-weekdays div {
    padding: 10px;
    text-align: center;
    font-weight: 600;
}

.esp-month-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.esp-day-cell {
    min-height: 100px;
    padding: 10px;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.esp-day-empty {
    background: #f8f9fa;
}

.esp-has-lessons {
    background: #e3f2fd;
    cursor: pointer;
}

.esp-day-number {
    font-weight: 600;
    margin-bottom: 5px;
}

.esp-day-lessons-count {
    font-size: 11px;
    color: #007cba;
    font-weight: 600;
}

/* ============================================
   БАЛАНС И ПРОФИЛЬ
   ============================================ */

.esp-balance-widget {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.esp-balance-amount {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.esp-balance-negative {
    color: #ffb8b8;
}

.esp-balance-positive {
    color: #fff;
}

.esp-last-payment {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
}

.esp-profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.esp-profile-avatar {
    position: relative;
}

.esp-profile-avatar img {
    border-radius: 50%;
    border: 3px solid #f0f0f1;
}

.esp-profile-details {
    flex: 1;
}

.esp-profile-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.esp-profile-email,
.esp-profile-phone {
    color: #6c757d;
    font-size: 14px;
}

/* ============================================
   УВЕДОМЛЕНИЯ
   ============================================ */

.esp-notifications-widget {
    background: #fff8e5;
}

.esp-notification-badge {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    border-radius: 10px;
}

.esp-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
    cursor: pointer;
}

.esp-notification-item:last-child {
    border-bottom: none;
}

.esp-notification-unread {
    background: rgba(0,124,186,0.05);
}

.esp-notification-icon {
    color: #007cba;
}

.esp-notification-icon.warning {
    color: #ffc107;
}

.esp-notification-icon.error {
    color: #dc3545;
}

.esp-notification-content {
    flex: 1;
}

.esp-notification-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.esp-notification-message {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 4px;
}

.esp-notification-time {
    font-size: 11px;
    color: #adb5bd;
}

/* ============================================
   ФОРМА ОПЛАТЫ
   ============================================ */

.esp-payment-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.esp-payment-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.esp-payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.esp-payment-row:last-child {
    margin-bottom: 0;
}

.esp-payment-amount {
    font-size: 28px;
    font-weight: 700;
    color: #28a745;
}

.esp-payment-methods {
    margin-bottom: 25px;
}

.esp-payment-method-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.esp-payment-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.esp-payment-method:hover {
    border-color: #007cba;
    background: #f0f8ff;
}

.esp-payment-method.active {
    border-color: #007cba;
    background: #e3f2fd;
}

.esp-method-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #007cba;
}

.esp-method-label {
    flex: 1;
}

.esp-method-label strong {
    display: block;
    margin-bottom: 4px;
}

.esp-method-label small {
    display: block;
    color: #6c757d;
    font-size: 11px;
}

.esp-payment-actions {
    text-align: center;
}

.esp-button-pay {
    width: 100%;
    margin-bottom: 15px;
}

.esp-payment-security {
    color: #6c757d;
    font-size: 13px;
    margin: 0;
}

.esp-payment-security .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.esp-test-mode-notice {
    margin-top: 20px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

/* ============================================
   ПРОФИЛЬ РЕДАКТИРОВАНИЕ
   ============================================ */

.esp-profile-editor {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
}

.esp-profile-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.esp-profile-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.esp-profile-section h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
}

.esp-avatar-upload {
    display: flex;
    align-items: center;
    gap: 20px;
}

.esp-avatar-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f1;
}

.esp-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.esp-avatar-edit {
    display: inline-block;
    padding: 8px 16px;
    background: #f0f0f1;
    border-radius: 4px;
    cursor: pointer;
}

.esp-avatar-edit:hover {
    background: #e0e0e0;
}

.esp-avatar-edit input {
    display: none;
}

.esp-profile-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.esp-profile-field.readonly {
    background: #f8f9fa;
    border-color: transparent;
}

.esp-profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА
   ============================================ */

.esp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.6);
    overflow-y: auto;
}

.esp-modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin: 50px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.esp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.esp-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.esp-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6c757d;
}

.esp-modal-close:hover {
    color: #333;
}

.esp-modal-body {
    padding: 25px;
}

.esp-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
}

/* ============================================
   УВЕДОМЛЕНИЯ (TOAST)
   ============================================ */

.esp-notification {
    position: fixed;
    top: 32px;
    right: 20px;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 450px;
    padding: 15px 20px;
    background: #fff;
    border-left: 4px solid #28a745;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
}

.esp-notification.error {
    border-left-color: #dc3545;
}

.esp-notification.warning {
    border-left-color: #ffc107;
}

.esp-notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.esp-notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #adb5bd;
}

.esp-notification-close:hover {
    color: #6c757d;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   АНИМАЦИИ
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.esp-fade-in {
    animation: fadeIn 0.3s ease;
}

.esp-slide-up {
    animation: slideUp 0.3s ease;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 1024px) {
    .esp-dashboard-grid {
        gap: 20px;
    }
    
    .esp-payment-method-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .esp-schedule-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .esp-schedule-navigation {
        width: 100%;
        justify-content: space-between;
    }
    
    .esp-schedule-grid {
        grid-template-columns: 1fr;
    }
    
    .esp-schedule-day {
        margin-bottom: 20px;
    }
    
    .esp-invoices-table {
        font-size: 13px;
    }
    
    .esp-invoices-table th,
    .esp-invoices-table td {
        padding: 8px;
    }
    
    .esp-payment-card {
        padding: 20px;
    }
    
    .esp-payment-amount {
        font-size: 24px;
    }
    
    .esp-notification {
        top: 46px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .esp-profile-info {
        flex-direction: column;
        text-align: center;
    }
    
    .esp-avatar-upload {
        flex-direction: column;
        text-align: center;
    }
    
    .esp-payment-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .esp-invoices-table {
        display: block;
        overflow-x: auto;
    }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */

@media print {
    .esp-schedule-navigation,
    .esp-button,
    .esp-modal-close,
    .esp-notification {
        display: none !important;
    }
    
    .esp-week-schedule,
    .esp-invoices-table,
    .esp-payment-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    body {
        background: #fff;
    }
}