/**
 * Frontend CSS for Gift Card Manager
 * Save as: assets/css/frontend.css
 */

/* Main Container */
.gift-card-manager-container {
    max-width: 1000px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Sections */
.gcm-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gcm-section h2, .gcm-section h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #f5f5f5;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

/* Forms */
.gcm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gcm-form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gcm-form-row.gcm-form-row-inline {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.gcm-form-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.gcm-form-input {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gcm-form-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.gcm-form-input.gcm-error {
    border-color: #d63638;
}

.gcm-form-input.gcm-success {
    border-color: #00a32a;
}

.gcm-form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* Buttons */
.gcm-button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-height: 44px;
    box-sizing: border-box;
}

.gcm-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gcm-button-primary {
    background: #2271b1;
    color: white;
}

.gcm-button-primary:hover:not(:disabled) {
    background: #135e96;
    color: white;
}

.gcm-button-secondary {
    background: #f6f7f7;
    color: #2c3338;
    border: 1px solid #dcdcde;
}

.gcm-button-secondary:hover:not(:disabled) {
    background: #f0f0f1;
    color: #2c3338;
}

.gcm-button-small {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
}

/* Gift Card Details */
.gcm-gift-card-details {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
}

.gcm-gift-card-details h4 {
    margin-top: 0;
    color: #0073aa;
    font-size: 16px;
}

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

.gcm-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 115, 170, 0.1);
}

.gcm-detail-item:last-child {
    border-bottom: none;
}

.gcm-detail-label {
    font-weight: 600;
    color: #555;
}

.gcm-detail-value {
    font-weight: 500;
    color: #333;
}

.gcm-detail-value.gcm-balance {
    color: #00a32a;
    font-weight: 700;
    font-size: 16px;
}

/* Date Filter */
.gcm-date-filter {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gcm-date-filter label {
    font-weight: 600;
    color: #333;
}

.gcm-date-filter input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Appointments Table */
.gcm-appointments-container {
    overflow-x: auto;
    margin-top: 16px;
}

.gcm-appointments-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gcm-appointments-table th {
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    color: white;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid #135e96;
}

.gcm-appointments-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.gcm-appointments-table tbody tr {
    transition: background-color 0.2s ease;
}

.gcm-appointments-table tbody tr:hover {
    background-color: #f8f9fa;
}

.gcm-appointments-table tbody tr.gcm-selected {
    background-color: #e7f3ff;
    border-left: 4px solid #2271b1;
}

.gcm-appointments-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.gcm-appointments-table tbody tr:nth-child(even):hover {
    background-color: #f0f0f0;
}

/* Client Info */
.gcm-client-info {
    line-height: 1.5;
}

.gcm-client-name {
    font-weight: 600;
    color: #333;
}

.gcm-client-email {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.gcm-client-phone {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

/* Service Info */
.gcm-service-info {
    font-weight: 500;
    color: #333;
}

/* Staff Info */
.gcm-staff-info {
    color: #666;
    font-size: 14px;
}

/* Time Display */
.gcm-time-display {
    font-family: 'Courier New', monospace;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

/* Amount Styling */
.gcm-amount {
    font-weight: 600;
    font-size: 14px;
}

.gcm-amount.gcm-positive {
    color: #d63638;
}

.gcm-amount.gcm-negative {
    color: #00a32a;
}

.gcm-amount.gcm-zero {
    color: #666;
}

/* Status Indicators */
.gcm-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.gcm-status.gcm-paid {
    background: #d1e7dd;
    color: #0f5132;
}

.gcm-status.gcm-partial {
    background: #fff3cd;
    color: #664d03;
}

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

/* Messages */
.gcm-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gcm-message.gcm-success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.gcm-message.gcm-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.gcm-message.gcm-warning {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    color: #664d03;
}

.gcm-message.gcm-info {
    background: #d1ecf1;
    border: 1px solid #b8daff;
    color: #0c5460;
}

/* Loading States */
.gcm-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.gcm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: gcm-spin 1s linear infinite;
    z-index: 1000;
}

@keyframes gcm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gcm-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: gcm-skeleton 1.5s infinite;
    border-radius: 4px;
    height: 20px;
    margin: 4px 0;
}

@keyframes gcm-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty States */
.gcm-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #666;
}

.gcm-empty-state .gcm-empty-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

.gcm-empty-state .gcm-empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.gcm-empty-state .gcm-empty-description {
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Access Denied */
.gcm-access-denied {
    text-align: center;
    padding: 40px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

.gcm-access-denied h3 {
    margin-top: 0;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gcm-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .gcm-form-row.gcm-form-row-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gcm-details-grid {
        grid-template-columns: 1fr;
    }
    
    .gcm-appointments-table {
        font-size: 13px;
    }
    
    .gcm-appointments-table th,
    .gcm-appointments-table td {
        padding: 12px 8px;
    }
    
    .gcm-button {
        width: 100%;
        justify-content: center;
    }
    
    .gcm-date-filter {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .gift-card-manager-container {
        margin: 10px 0;
    }
    
    .gcm-section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .gcm-appointments-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .gcm-appointments-table thead,
    .gcm-appointments-table tbody,
    .gcm-appointments-table th,
    .gcm-appointments-table td,
    .gcm-appointments-table tr {
        display: block;
    }
    
    .gcm-appointments-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .gcm-appointments-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 6px;
        background: white;
    }
    
    .gcm-appointments-table td {
        border: none;
        position: relative;
        padding-left: 40%;
        white-space: normal;
        text-align: left;
    }
    
    .gcm-appointments-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #333;
    }
}

/* Print Styles */
@media print {
    .gcm-button,
    .gcm-date-filter {
        display: none !important;
    }
    
    .gcm-section {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .gcm-appointments-table {
        border-collapse: collapse;
    }
    
    .gcm-appointments-table th,
    .gcm-appointments-table td {
        border: 1px solid #000;
        padding: 8px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .gcm-section {
        border: 2px solid #000;
    }
    
    .gcm-button-primary {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .gcm-appointments-table th {
        background: #000;
        color: #fff;
    }
    
    .gcm-amount.gcm-positive {
        color: #000;
        font-weight: 900;
    }
    
    .gcm-amount.gcm-negative {
        color: #000;
        font-weight: 900;
        text-decoration: underline;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gcm-button,
    .gcm-form-input,
    .gcm-appointments-table tbody tr {
        transition: none;
    }
    
    .gcm-loading::after,
    .gcm-skeleton {
        animation: none;
    }
}