/* VoxCloud Customer Portal Styles */
:root {
    --primary-color: #F56600;
    --primary-dark: #d45500;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: var(--white);
    padding: 3rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-box h2 {
    text-align: center;
    color: var(--text-light);
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    color: var(--danger-color);
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 5px;
    background: #f8d7da;
    display: none;
}

.error-message.show {
    display: block;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--text-light);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--text-dark);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Registration Form Styles */
.register-box {
    max-width: 500px;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.btn-full {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.success-message {
    color: var(--success-color);
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 5px;
    background: #d4edda;
    display: none;
    text-align: center;
}

.success-message.show {
    display: block;
}

.form-group input::placeholder {
    color: #aaa;
    font-size: 0.9rem;
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background: var(--white);
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Dashboard Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

section {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

section h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

/* Customer Info */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
}

.info-item span {
    font-size: 1.1rem;
    color: var(--text-dark);
}

/* License Cards */
.license-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.license-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.license-key {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
}

.license-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.license-status.active {
    background: var(--success-color);
    color: var(--white);
}

.license-status.inactive {
    background: var(--danger-color);
    color: var(--white);
}

.license-status.trial {
    background: var(--warning-color);
    color: var(--text-dark);
}

.license-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.license-detail {
    display: flex;
    flex-direction: column;
}

.license-detail label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
}

.license-detail span {
    font-size: 1rem;
    color: var(--text-dark);
}

/* Instance Cards */
.instance-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.instance-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-dark);
}

.instance-url {
    font-family: 'Courier New', monospace;
    color: var(--text-light);
    font-size: 0.9rem;
}

.instance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat {
    text-align: center;
    padding: 1rem;
    background: var(--white);
    border-radius: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.loading {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

/* Footer */
.footer {
    background: var(--white);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-light);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .license-header,
    .instance-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    section {
        padding: 1rem;
    }
}

/* Ticket Section Styles */
.tickets-section {
    margin-top: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.ticket-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.ticket-header h3 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.ticket-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-open {
    background: #e3f2fd;
    color: #1976d2;
}

.status-in_progress {
    background: #fff3e0;
    color: #f57c00;
}

.status-waiting_customer {
    background: #fce4ec;
    color: #c2185b;
}

.status-closed {
    background: #f5f5f5;
    color: #616161;
}

.ticket-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-light);
}

.priority {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.priority-normal {
    background: #e3f2fd;
    color: #1565c0;
}

.priority-high {
    background: #fff3e0;
    color: #e65100;
}

.priority-urgent {
    background: #ffebee;
    color: #c62828;
}

.unread-badge {
    background: var(--danger-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.ticket-info {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row .label {
    font-weight: 600;
    min-width: 80px;
}

.ticket-messages {
    margin-bottom: 1.5rem;
}

.message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.message.customer {
    background: #e3f2fd;
    border-left-color: #1976d2;
}

.message.admin {
    background: #f3e5f5;
    border-left-color: #7b1fa2;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.message-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.message-body {
    color: var(--text-dark);
    line-height: 1.6;
}

.reply-form {
    margin-top: 1.5rem;
}

.reply-form h3 {
    margin-bottom: 1rem;
}

.reply-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
    resize: vertical;
}

.closed-notice {
    text-align: center;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 6px;
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Attachment Styles */
.message-attachments {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.message-attachments strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.attachment-link {
    display: inline-block;
    margin: 0.25rem 0.5rem 0.25rem 0;
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.attachment-link:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.file-list {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

input[type="file"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
    font-size: 0.9rem;
}

/* App Type Badges */
.app-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.app-type-badge.metavox {
    background: #e3f2fd;
    color: #1565c0;
}

.app-type-badge.intravox {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Dashboard Overview Cards */
.dashboard-overview { margin-bottom: 24px; }
.overview-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.overview-card { display: flex; align-items: center; gap: 16px; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.overview-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.overview-info { display: flex; flex-direction: column; }
.overview-value { font-size: 1.5rem; font-weight: 700; color: #1f2937; }
.overview-label { font-size: 0.85rem; color: #6b7280; }
