* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --accent-primary: #fb923c;
    --accent-secondary: #ea580c;
    --border-color: rgba(148, 163, 184, 0.1);
    --hover-bg: rgba(251, 146, 60, 0.1);
    --card-bg: rgba(30, 41, 59, 0.8);
    --input-bg: rgba(30, 41, 59, 0.8);
    --chat-user-bg: rgba(30, 41, 59, 0.9);
    --chat-admin-bg: rgba(251, 146, 60, 0.15);
}

body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --border-color: rgba(226, 232, 240, 0.5);
    --hover-bg: rgba(251, 146, 60, 0.1);
    --card-bg: rgba(255, 255, 255, 0.9);
    --input-bg: rgba(248, 250, 252, 0.8);
    --chat-user-bg: rgba(248, 250, 252, 0.9);
    --chat-admin-bg: rgba(251, 146, 60, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 40px;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Navigation */
nav {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease;
}

body.light-theme nav {
    background: rgba(248, 250, 252, 0.95);
}

.nav-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-left: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #fb923c, #ea580c);
    transition: width 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fb923c;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Main Container */
.support-main {
    max-width: 98%;
    width: 100%;
    margin-top: 4rem;
    margin: 2rem auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s ease-out;
}

.page-header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fb923c 0%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.page-header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

body.light-theme .stat-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(251, 146, 60, 0.5);
    box-shadow: 0 10px 30px rgba(251, 146, 60, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fb923c, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Tabs */
.tabs-container {
    background: var(--card-bg);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    overflow: hidden;
    margin-bottom: 2rem;
}

.tabs-header {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid rgba(251, 146, 60, 0.2);
    padding: 0;
}

.tab-btn {
    padding: 1.2rem 2rem;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: #fb923c;
    background: var(--hover-bg);
}

.tab-btn.active {
    color: #fb923c;
    background: var(--bg-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #fb923c, #ea580c);
}

.tab-badge {
    background: #dc2626;
    color: white;
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.tab-content {
    display: none;
    padding: 2.5rem;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

/* Forms */
.ticket-form {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.ticket-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #fb923c;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 0;
    margin-bottom: .5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #fb923c;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.priority-indicator {
    background-color: rgba(228, 65, 0, 0.2);
    border: 1px solid rgba(228, 65, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    width: fit-content;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    height: 120px;
    resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

.submit-btn {
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: white;
    border: none;
    margin-top: 1.5rem;
    padding: 1.2rem 2.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(251, 146, 60, 0.4);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tickets Grid */
.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
    width: 100%;
}

.ticket-card {
    background: var(--card-bg);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 250px;
}

body.light-theme .ticket-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #fb923c;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.ticket-card.clickable:hover::before {
    transform: scaleY(1);
}

.ticket-card.clickable:hover {
    border-color: rgba(251, 146, 60, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(251, 146, 60, 0.2);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.ticket-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.3;
    flex: 1;
}

.ticket-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
    flex-shrink: 0;
}

.ticket-category {
    background: #fb923c;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ticket-priority {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
}

.ticket-priority.priority-alta,
.ticket-priority.priority-high { 
    background: linear-gradient(135deg, #dc2626, #ef4444); 
}

.ticket-priority.priority-media,
.ticket-priority.priority-medium { 
    background: linear-gradient(135deg, #ea580c, #fb923c); 
}

.ticket-priority.priority-baja,
.ticket-priority.priority-low { 
    background: linear-gradient(135deg, #16a34a, #22c55e); 
}

.ticket-priority.priority-total { 
    background: linear-gradient(135deg, #7c3aed, #a855f7); 
}

.ticket-info {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.ticket-description {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
}

.ticket-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Chat System */
.chat-container {
    background: var(--card-bg);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 16px;
    overflow: hidden;
    height: 700px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(251, 146, 60, 0.2);
}

.chat-title {
    color: #fb923c;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.chat-subtitle {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 60%;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    animation: messageSlide 0.3s ease-out;
}

.message.user {
    background: var(--chat-user-bg);
    border: 1px solid var(--border-color);
    align-self: flex-start;
}

.message.admin {
    background: var(--chat-admin-bg);
    border: 1px solid rgba(251, 146, 60, 0.3);
    align-self: flex-end;
}

.message-content {
    margin-bottom: 0.5rem;
    line-height: 1.4;
    word-wrap: break-word;
    color: var(--text-primary);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: right;
}

.chat-input-container {
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-top: 1px solid rgba(251, 146, 60, 0.2);
    display: flex;
    gap: 1rem;
}

.chat-input {
    flex: 1;
    padding: 1rem;
    background: var(--input-bg);
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #fb923c;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1);
}

.chat-btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn {
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: white;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(251, 146, 60, 0.4);
}

.close-btn {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
}

.close-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
    color: var(--text-tertiary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(251, 146, 60, 0.2);
    border-left: 3px solid #fb923c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    margin-top: auto;
    transition: background 0.3s ease;
}

body.light-theme footer {
    background: rgba(248, 250, 252, 0.95);
}

.footer-content {
    max-width: 95%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
}

.footer-text {
    color: #22c55e;
    font-size: 0.95rem;
}

.footer-contact {
    color: var(--text-primary);
    font-size: 0.9rem;
    text-decoration: none;
    position: relative;
    transition: all 0.3s;
}

.footer-contact::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff8819, #ea580c);
    transition: width 0.3s;
}

.footer-contact:hover {
    color: #fb923c;
}

.footer-contact:hover::after {
    width: 100%;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 12px;
    transition: all 0.3s;
}

.social-links a:hover {
    transform: translateY(-3px);
    background: rgba(251, 146, 60, 0.2);
}

.social-icon {
    width: 28px;
    height: 28px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1200px) {
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .support-main {
        padding: 1rem 1.5rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .tickets-grid {
        grid-template-columns: 1fr;
    }

    .tabs-header {
        flex-direction: column;
    }

    .message {
        max-width: 85%;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
}