/**
 * Neural-Ink - Shared Styles
 * e-ink display magic
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Container */
.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 600px;
    width: 100%;
    padding: 40px;
    position: relative;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

.back-btn {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    color: #333;
    font-weight: 500;
}

.back-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
    flex: 1;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

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

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

.alert.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
    box-sizing: border-box;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

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

/* Buttons */
.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

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

.btn-secondary:hover {
    box-shadow: 0 5px 20px rgba(108, 117, 125, 0.4);
}

.btn-scan {
    width: 100%;
    padding: 12px 20px;
    margin-bottom: 20px;
    margin-top: 10px;
    font-size: 15px;
    background: #28a745;
    font-weight: 600;
}

.btn-scan:hover {
    background: #218838;
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.add-device-btn {
    margin-bottom: 20px;
}

/* Device List */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.device-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s;
}

.device-card:hover {
    border-color: #667eea;
    box-shadow: 0 3px 15px rgba(102, 126, 234, 0.2);
}

.device-info {
    flex: 1;
}

.device-info h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 18px;
}

.device-address {
    color: #666;
    font-size: 13px;
    font-family: monospace;
    margin-bottom: 5px;
}

.device-last-used {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.device-notes {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
}

.device-actions {
    display: flex;
    gap: 10px;
    margin-left: 15px;
}

.btn-icon {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.btn-icon:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p:first-child {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state .subtitle {
    color: #999;
    margin: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1000;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    width: auto;
    flex: 1;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 24px;
    }

    .device-card {
        flex-direction: column;
    }

    .device-actions {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
        justify-content: flex-end;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}
