/**
 * Zhisper Plugin Styles
 * Version: 1.0.1
 */

/* Container and Base Styles */
.zhisper-container,
.zhisper-messages-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Form Styles */
.zhisper-message-form {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.zhisper-form-group {
    margin-bottom: 20px;
}

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

.zhisper-form-group label .required {
    color: #d63638;
}

.zhisper-input,
.zhisper-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.zhisper-input:focus,
.zhisper-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.zhisper-textarea {
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.zhisper-help-text,
.zhisper-char-count {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.zhisper-char-count {
    float: right;
}

/* Button Styles */
.zhisper-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

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

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

.zhisper-button-secondary:hover:not(:disabled) {
    background: #545b62;
}

/* Loading Spinner */
.zhisper-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: zhisper-spin 0.8s ease-in-out infinite;
}

@keyframes zhisper-spin {
    to { transform: rotate(360deg); }
}

/* Result Messages */
.zhisper-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    font-size: 14px;
}

.zhisper-result-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

.zhisper-result-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Viewing Key Display */
.zhisper-viewing-key {
    margin-top: 30px;
}

.zhisper-success-box {
    background: #ffffff;
    padding: 25px;
    border-radius: 8px;
    border: 2px solid #28a745;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.1);
}

.zhisper-success-box h3 {
    margin-top: 0;
    color: #28a745;
}

.zhisper-important {
    background: #fff3cd;
    padding: 12px;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
}

.zhisper-key-box {
    margin: 20px 0;
}

.zhisper-key-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.zhisper-key-value {
    display: flex;
    gap: 10px;
}

.zhisper-key-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    background: #f8f9fa;
}

.zhisper-copy-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    white-space: nowrap;
}

.zhisper-copy-btn:hover {
    background: #0056b3;
}

.zhisper-copy-btn.copied {
    background: #28a745;
}

.zhisper-warning-box {
    background: #fff3cd;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #ffc107;
    margin-top: 15px;
}

.zhisper-warning-box p {
    margin: 0;
}

/* Decrypt Section */
.zhisper-decrypt-section {
    background: #f0f8ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #cce5ff;
}

.zhisper-decrypt-section h3 {
    margin-top: 0;
    color: #004085;
}

.zhisper-inline-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.zhisper-inline-form .zhisper-input {
    flex: 1;
}

/* Messages List */
.zhisper-messages-list {
    display: grid;
    gap: 20px;
}

.zhisper-no-messages {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Message Cards */
.zhisper-message-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.zhisper-message-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.zhisper-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.zhisper-message-date {
    color: #666;
    font-size: 14px;
}

.zhisper-message-id {
    color: #999;
    font-size: 12px;
    font-family: monospace;
}

.zhisper-message-body {
    margin: 15px 0;
}

.zhisper-encrypted-text,
.zhisper-decrypted-text {
    margin: 10px 0;
}

.zhisper-encrypted-text strong,
.zhisper-decrypted-text strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

.zhisper-encrypted-code {
    display: block;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    font-size: 11px;
    word-break: break-all;
    font-family: monospace;
    color: #666;
}

.zhisper-decrypted-text {
    background: #d4edda;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

.zhisper-decrypted-content {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #155724;
}

.zhisper-message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.zhisper-link {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.zhisper-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.zhisper-demo-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #ffc107;
    color: #000;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.zhisper-decrypt-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.zhisper-decrypt-btn:hover:not(:disabled) {
    background: #218838;
}

.zhisper-decrypt-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.zhisper-decrypt-btn.zhisper-decrypted {
    background: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .zhisper-container,
    .zhisper-messages-container {
        padding: 15px;
    }
    
    .zhisper-message-form {
        padding: 20px;
    }
    
    .zhisper-inline-form {
        flex-direction: column;
    }
    
    .zhisper-message-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .zhisper-key-value {
        flex-direction: column;
    }
    
    .zhisper-copy-btn {
        width: 100%;
    }
    
    .zhisper-message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Print Styles */
@media print {
    .zhisper-decrypt-section,
    .zhisper-decrypt-btn,
    .zhisper-copy-btn,
    .zhisper-button {
        display: none;
    }
    
    .zhisper-message-card {
        break-inside: avoid;
    }
}

/* Accessibility */
.zhisper-button:focus,
.zhisper-input:focus,
.zhisper-textarea:focus,
.zhisper-copy-btn:focus,
.zhisper-decrypt-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Animation for fade effects */
@keyframes zhisper-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.zhisper-result,
.zhisper-viewing-key {
    animation: zhisper-fade-in 0.3s ease-out;
}

/* Countdown Timer Display */
.zhisper-countdown-display {
    margin-top: 30px;
    animation: zhisper-fade-in 0.3s ease-out;
}

.zhisper-countdown-warning {
    background: #d1ecf1;
    border: 2px solid #0c5460;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
}

.zhisper-countdown-warning h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #0c5460;
}

#zhisper-countdown-timer {
    display: inline-block;
    font-size: 32px;
    font-weight: bold;
    color: #0c5460;
    min-width: 50px;
    padding: 0 5px;
    transition: all 0.3s;
}

.zhisper-countdown-warning p {
    margin: 10px 0 20px 0;
    font-size: 16px;
    color: #0c5460;
}

.zhisper-countdown-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.zhisper-pause-btn,
.zhisper-resume-btn {
    background: #ffc107;
    color: #000;
    font-weight: 600;
}

.zhisper-pause-btn:hover:not(:disabled),
.zhisper-resume-btn:hover:not(:disabled) {
    background: #e0a800;
}

.zhisper-resume-btn {
    background: #28a745;
    color: white;
}

.zhisper-resume-btn:hover:not(:disabled) {
    background: #218838;
}

/* Responsive countdown */
@media (max-width: 768px) {
    .zhisper-countdown-controls {
        flex-direction: column;
    }
    
    .zhisper-countdown-controls .zhisper-button {
        width: 100%;
    }
    
    #zhisper-countdown-timer {
        font-size: 28px;
    }
    
    .zhisper-countdown-warning h4 {
        font-size: 18px;
    }
}
