/* ========================================
   PTA Payment Portal - Main Styles
   Modern, Premium Design System
   ======================================== */

/* CSS Variables - Design Tokens */
:root {
    /* Primary Colors - Vibrant Blue-Purple Gradient */
    --primary-50: #f0f4ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Accent Colors - Vibrant Teal */
    --accent-50: #f0fdfa;
    --accent-100: #ccfbf1;
    --accent-200: #99f6e4;
    --accent-300: #5eead4;
    --accent-400: #2dd4bf;
    --accent-500: #14b8a6;
    --accent-600: #0d9488;
    --accent-700: #0f766e;
    --accent-800: #115e59;
    --accent-900: #134e4a;

    /* Success, Warning, Error */
    --success-500: #10b981;
    --success-600: #059669;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --error-500: #ef4444;
    --error-600: #dc2626;

    /* Neutral Colors - Modern Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Dark Mode Colors */
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-surface-hover: #334155;
    --dark-border: #334155;
    --dark-text: #f1f5f9;
    --dark-text-secondary: #cbd5e1;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
}

/* ========================================
   Reset & Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-900);
    background-color: var(--gray-50);
    overflow-x: hidden;
}

/* ========================================
   Typography
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--gray-900);
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: var(--spacing-md);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-200);
    border-color: var(--gray-400);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-600), var(--success-500));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--success-700), var(--success-600));
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error-600), var(--error-500));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--error-700), var(--error-600));
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ========================================
   Form Elements
   ======================================== */

.form-group {
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--gray-400);
    pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    color: var(--gray-900);
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.input-wrapper input {
    padding-left: 3rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========================================
   Cards
   ======================================== */

.card {
    background-color: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: var(--spacing-xl);
}

.card-footer {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-50);
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
}

.alert svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ========================================
   Badges
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-primary {
    background-color: var(--primary-100);
    color: var(--primary-800);
}

/* ========================================
   Spinner / Loader
   ======================================== */

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Utilities
   ======================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mt-4 {
    margin-top: var(--spacing-xl);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.mb-4 {
    margin-bottom: var(--spacing-xl);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: var(--spacing-sm);
}

.gap-2 {
    gap: var(--spacing-md);
}

.gap-3 {
    gap: var(--spacing-lg);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    h1 {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.125rem;
    }

    .card-body {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 480px) {
    .card-body {
        padding: var(--spacing-md);
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 2rem;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-2xl);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--gray-900);
}

/* Print Styles for Receipt */
@media print {
    @page {
        size: letter;
        /* Use standard Letter size */
        margin: 0.5in;
        /* Default print margin */
    }

    body {
        background-color: white;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        color: black;
    }

    /* Hide main layout elements */
    .sidebar,
    .header,
    .main-content>.header,
    .filter-section,
    .form-section,
    .payment-stats,
    .table-responsive,
    .modal,
    button,
    .btn,
    .card,
    h2:not(.receipt-header h2),
    nav,
    .toast,
    .toast-container,
    .notification {
        display: none !important;
    }

    /* Only show Receipt Modal content */
    #receiptModal {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    /* Compact Receipt */
    #receiptModal .receipt {
        display: block !important;
        width: 3in !important;
        max-width: 3in !important;
        height: auto !important;
        min-height: auto !important;

        padding: 5px !important;
        border: 1px dashed #000 !important;
        box-shadow: none !important;

        font-family: 'Inter', sans-serif;
        font-size: 9px;
        overflow: hidden !important;
    }

    /* Typography adjustments */
    .receipt-header h2 {
        font-size: 11px;
        font-weight: bold;
        text-align: center;
        margin-bottom: 1px;
        color: black !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .receipt-header p {
        font-size: 7px;
        text-align: center;
        margin-bottom: 3px;
        color: #333 !important;
    }

    .receipt-header h3 {
        font-size: 10px;
        text-align: center;
        border-bottom: 1px solid #000;
        padding-bottom: 2px;
        margin-bottom: 5px;
        font-weight: 600;
    }

    .receipt-details {
        margin-top: 3px;
    }

    .receipt-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 2px;
        align-items: flex-start;
        flex-wrap: nowrap;
    }

    .receipt-row strong {
        font-weight: 600;
        font-size: 9px;
        flex-shrink: 0;
        margin-right: 5px;
    }

    .receipt-row span {
        font-size: 9px;
        text-align: right;
        word-break: break-word;
        max-width: 65%;
    }

    .receipt-total {
        border-top: 1px solid #000;
        margin-top: 5px;
        padding-top: 3px;
    }

    .receipt-total .receipt-row strong {
        font-size: 11px;
    }

    /* Footer */
    .receipt div[style*="margin-top"] {
        margin-top: 10px !important;
        padding-top: 3px !important;
        border-top: 1px solid #ccc !important;
    }

    .receipt p {
        font-size: 7px !important;
        margin: 1px 0 !important;
        text-align: center;
    }
}