/* Dragon Crusade User Panel - Material Design 3 CSS Framework */

:root {
    /* Primary Colors */
    --primary: #6750A4;
    --on-primary: #FFFFFF;
    --primary-container: #EADDFF;
    --on-primary-container: #21005D;

    /* Secondary Colors */
    --secondary: #625B71;
    --on-secondary: #FFFFFF;
    --secondary-container: #E8DEF8;
    --on-secondary-container: #1F192C;

    /* Tertiary Colors */
    --tertiary: #7D5260;
    --on-tertiary: #FFFFFF;
    --tertiary-container: #FFD8E4;
    --on-tertiary-container: #31111D;

    /* Surface Colors */
    --surface: #FEF7FF;
    --on-surface: #1D1B20;
    --surface-variant: #E7E0EC;
    --on-surface-variant: #49454F;

    /* Error Colors */
    --error: #BA1A1A;
    --on-error: #FFFFFF;
    --error-container: #F9DEDC;
    --on-error-container: #410E0B;

    /* Additional Colors */
    --outline: #79747E;
    --outline-variant: #CAC4D0;
    --scrim: #000000;

    /* Semantic Colors */
    --success: #4CAF50;
    --warning: #FF9800;
    --info: #2196F3;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.2);

    /* Elevation */
    --elevation-1: 0 1px 3px rgba(0, 0, 0, 0.12);
    --elevation-2: 0 3px 6px rgba(0, 0, 0, 0.15);
    --elevation-3: 0 6px 12px rgba(0, 0, 0, 0.18);

    /* Typography */
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Text Sizes */
    --text-display-large: 57px;
    --text-display-medium: 45px;
    --text-display-small: 36px;
    --text-headline-large: 32px;
    --text-headline-medium: 28px;
    --text-headline-small: 24px;
    --text-title-large: 22px;
    --text-title-medium: 16px;
    --text-title-small: 14px;
    --text-body-large: 16px;
    --text-body-medium: 14px;
    --text-body-small: 12px;
    --text-label-large: 14px;
    --text-label-medium: 12px;
    --text-label-small: 11px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-standard: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-body-medium);
    font-weight: var(--font-weight-regular);
    color: var(--on-surface);
    background-color: var(--surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Scales */
.text-display-large {
    font-size: var(--text-display-large);
    font-weight: var(--font-weight-light);
    line-height: 1.2;
}

.text-display-medium {
    font-size: var(--text-display-medium);
    font-weight: var(--font-weight-light);
    line-height: 1.2;
}

.text-headline-large {
    font-size: var(--text-headline-large);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
}

.text-headline-medium {
    font-size: var(--text-headline-medium);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
}

.text-headline-small {
    font-size: var(--text-headline-small);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
}

.text-title-large {
    font-size: var(--text-title-large);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
}

.text-title-medium {
    font-size: var(--text-title-medium);
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
}

.text-body-large {
    font-size: var(--text-body-large);
    font-weight: var(--font-weight-regular);
    line-height: 1.5;
}

.text-body-medium {
    font-size: var(--text-body-medium);
    font-weight: var(--font-weight-regular);
    line-height: 1.5;
}

.text-label-large {
    font-size: var(--text-label-large);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Headings */
h1, .h1 {
    font-size: var(--text-headline-large);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-lg);
}

h2, .h2 {
    font-size: var(--text-headline-medium);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-md);
}

h3, .h3 {
    font-size: var(--text-headline-small);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-md);
}

h4, h5, h6 {
    font-size: var(--text-title-large);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
}

p {
    margin-bottom: var(--spacing-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--text-label-large);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.btn:active::before {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Button Variants */
.btn-filled {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: var(--elevation-1);
}

.btn-filled:hover {
    box-shadow: var(--elevation-2);
    background: color-mix(in srgb, var(--primary) 90%, black);
}

.btn-filled:active {
    box-shadow: var(--elevation-1);
}

.btn-outlined {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--outline);
}

.btn-outlined:hover {
    background: var(--primary-container);
}

.btn-text {
    background: transparent;
    color: var(--primary);
    padding: 10px 12px;
}

.btn-text:hover {
    background: var(--primary-container);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--on-secondary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-error {
    background: var(--error);
    color: var(--on-error);
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--elevation-1);
    transition: box-shadow var(--transition-standard), transform var(--transition-standard);
    border: 1px solid var(--surface-variant);
}

.card:hover {
    box-shadow: var(--elevation-2);
    transform: translateY(-2px);
}

.card-elevated {
    box-shadow: var(--elevation-2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.card-body {
    width: 100%;
}

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--surface-variant);
}

/* Input Fields */
.input-field,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-variant);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--text-body-medium);
    color: var(--on-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(103, 80, 164, 0.1);
}

.input-field:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-label {
    display: block;
    font-size: var(--text-label-large);
    font-weight: var(--font-weight-medium);
    color: var(--on-surface);
    margin-bottom: var(--spacing-sm);
}

.input-group {
    margin-bottom: var(--spacing-lg);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    margin: calc(var(--spacing-lg) * -1);
}

.row > [class*='col-'] {
    flex: 0 0 auto;
    margin: var(--spacing-lg);
}

.col-12 { width: calc(100% - var(--spacing-lg) * 2); }
.col-11 { width: calc(91.666667% - var(--spacing-lg) * 2); }
.col-10 { width: calc(83.333333% - var(--spacing-lg) * 2); }
.col-9 { width: calc(75% - var(--spacing-lg) * 2); }
.col-8 { width: calc(66.666667% - var(--spacing-lg) * 2); }
.col-7 { width: calc(58.333333% - var(--spacing-lg) * 2); }
.col-6 { width: calc(50% - var(--spacing-lg) * 2); }
.col-5 { width: calc(41.666667% - var(--spacing-lg) * 2); }
.col-4 { width: calc(33.333333% - var(--spacing-lg) * 2); }
.col-3 { width: calc(25% - var(--spacing-lg) * 2); }
.col-2 { width: calc(16.666667% - var(--spacing-lg) * 2); }
.col-1 { width: calc(8.333333% - var(--spacing-lg) * 2); }

/* Grid */
.grid {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex Utilities */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-col {
    flex-direction: column;
}

.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    border-radius: var(--radius-full);
    font-size: var(--text-label-small);
    font-weight: var(--font-weight-semibold);
}

.badge-success {
    background: #C8E6C9;
    color: #1B5E20;
}

.badge-error {
    background: #FFCDD2;
    color: #B71C1C;
}

.badge-warning {
    background: #FFE0B2;
    color: #E65100;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--surface-variant);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table thead {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--surface-variant);
}

.table th {
    font-weight: var(--font-weight-semibold);
}

.table tbody tr:hover {
    background: var(--primary-container);
    opacity: 0.3;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Modals & Dialogs */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
}

.modal-backdrop.active {
    display: block;
    animation: fadeIn var(--transition-fast);
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    max-width: 500px;
    width: 90%;
    overflow-y: auto;
    max-height: 90vh;
}

.modal.active {
    display: block;
    animation: slideInScale var(--transition-standard);
}

.modal-header {
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--surface-variant);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-footer {
    padding: var(--spacing-xl);
    border-top: 1px solid var(--surface-variant);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* Alerts & Notifications */
.alert {
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.alert-success {
    background: #E8F5E9;
    color: #1B5E20;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #FFEBEE;
    color: #B71C1C;
    border-left: 4px solid var(--error);
}

.alert-warning {
    background: #FFF3E0;
    color: #E65100;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #E3F2FD;
    color: #0D47A1;
    border-left: 4px solid var(--info);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInScale {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.fade-in {
    animation: fadeIn var(--transition-standard);
}

.fade-out {
    animation: fadeOut var(--transition-standard);
}

.slide-in-up {
    animation: slideInUp var(--transition-standard);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-muted { color: var(--on-surface-variant); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --text-display-large: 45px;
        --text-display-medium: 36px;
        --text-headline-large: 28px;
        --text-headline-medium: 24px;
        --text-headline-small: 20px;
        --text-title-large: 18px;
        --text-title-medium: 14px;
        --text-body-large: 14px;
        --text-body-medium: 13px;
    }

    .container {
        padding: var(--spacing-md);
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .col-6,
    .col-8,
    .col-9,
    .col-10,
    .col-11,
    .col-12 {
        width: 100%;
    }

    .table {
        font-size: var(--text-body-small);
    }

    .table th,
    .table td {
        padding: var(--spacing-sm);
    }

    .modal {
        max-width: 95%;
        width: 95%;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-lg: 12px;
        --spacing-xl: 16px;
    }

    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .flex-col-mobile {
        flex-direction: column;
    }

    .hide-mobile {
        display: none !important;
    }
}
