/**
 * Support Ticketing System Styles
 * Matches PrivSense site aesthetic
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f7;
}

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

/* Header */
header {
    background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

header a {
    color: white;
    text-decoration: underline;
}

header a:hover {
    opacity: 0.8;
}

/* Main content */
main {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

.form-group-inline {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
}

.form-group-inline label {
    display: inline-block;
    margin-right: 5px;
}

.form-group-inline input,
.form-group-inline select {
    width: auto;
    min-width: 200px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

/* CAPTCHA */
.captcha-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.captcha-container img {
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    background: #fff;
}

.refresh-captcha {
    padding: 10px 15px;
    background: #0d9488;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s;
}

.refresh-captcha:hover {
    background: #5568d3;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #0d9488;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* Ticket Form */
.ticket-form {
    max-width: 700px;
    margin: 0 auto;
}

/* Ticket Details */
.ticket-details {
    max-width: 900px;
    margin: 0 auto;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.ticket-header h2 {
    font-size: 2rem;
    color: #333;
}

.ticket-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.ticket-info p {
    margin-bottom: 10px;
}

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

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-opened {
    background: #d4edda;
    color: #155724;
}

.status-closed {
    background: #f8d7da;
    color: #721c24;
}

/* Messages */
.messages {
    margin: 30px 0;
}

.messages h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid;
}

.message-client {
    background: #f8f9fa;
    border-color: #0d9488;
}

.message-admin {
    background: #e7f3ff;
    border-color: #007aff;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.message-time {
    color: #666;
    font-size: 0.85rem;
}

.message-body {
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.no-messages {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

/* Reply Form */
.reply-form {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.reply-form h3 {
    margin-bottom: 15px;
}

/* Admin Controls */
.admin-controls {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
}

.admin-actions {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.status-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-form label {
    margin-bottom: 0;
}

.status-form select {
    width: auto;
    min-width: 120px;
}

/* Tickets List */
.tickets-list h2 {
    margin-bottom: 20px;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.tickets-table th,
.tickets-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.tickets-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.tickets-table tr:hover {
    background: #f8f9fa;
}

.tickets-table td {
    vertical-align: top;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Actions */
.actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

footer a {
    color: #0d9488;
    text-decoration: none;
    margin: 0 10px;
}

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

/* Login Form */
.login-form {
    max-width: 400px;
    margin: 0 auto;
}

/* Ticket View Form */
.ticket-view-form {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

/* Google Sign-In Button */
.g_id_signin {
    margin-bottom: 15px;
}

#google-signin-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    border: 2px solid #0d9488;
    margin-bottom: 20px;
}

#user-info-section {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.user-info-display {
    background: white;
    padding: 10px;
    border-radius: 3px;
}

.user-info-display p {
    margin: 5px 0;
}

#submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Delete button styling */
.btn[style*="background: #dc3545"] {
    background: #dc3545 !important;
    color: white !important;
}

.btn[style*="background: #dc3545"]:hover {
    background: #c82333 !important;
}

.delete-section {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
}

.delete-section h4 {
    margin-top: 0;
    color: #856404;
}

.delete-section p {
    margin: 10px 0;
    color: #856404;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .container {
        padding: 10px;
    }

    main {
        padding: 20px;
    }

    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tickets-table {
        font-size: 0.9rem;
    }

    .tickets-table th,
    .tickets-table td {
        padding: 8px;
    }

    .filter-form {
        flex-direction: column;
    }

    .form-group-inline {
        display: block;
        width: 100%;
        margin-right: 0;
    }

    .form-group-inline input,
    .form-group-inline select {
        width: 100%;
    }

    .status-form {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-form select {
        width: 100%;
    }
}
